<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改送修记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/layui/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" method="post" id="applyForm">
    <div class="layui-form-item">
        <label class="layui-form-label">车牌号码:</label>
        <div class="layui-input-block">
            <input type="text"  autocomplete="off" class="layui-input" value="${repairRecord.car.carplate}" readonly="readonly">
            <input type="hidden" name="carid" value="${repairRecord.car.carid}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">修理厂:</label>
        <div class="layui-input-block">
            <select id="btypeid" name="btypeid">
                <c:forEach items="${repairBtype}" var="btype">
                    <option value="${btype.btypeid}"
                            <c:if test="${btype.btypeid == repairRecord.btypeid}">
                                selected="selected"
                            </c:if>
                    >${btype.btypename}</option>
                </c:forEach>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">送修时间:</label>
        <div class="layui-input-block">
            <input type="text" name="repairstarttime" class="layui-input usetime" value="<fmt:formatDate value="${repairRecord.repairstarttime}"  type="both" />" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">预计取车时间:</label>
        <div class="layui-input-block">
            <input type="text" name="repairplanendtime" class="layui-input usetime" value="<fmt:formatDate value="${repairRecord.repairplanendtime}"  type="both" />" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">送修原因:</label>
        <div class="layui-input-block">
            <input type="text" id="repairreason" name="repairreason" value="${repairRecord.repairreason}" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">送修备注:</label>
        <div class="layui-input-block">
            <input type="text" id="remarkto" name="remarkto" value="${repairRecord.remarkto}" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">经办人:</label>
        <div class="layui-input-block">
            <input type="text" value="${repairRecord.driver.dirvername}" autocomplete="off" class="layui-input">
            <input type="hidden" name="driverid" value="${repairRecord.driverid}">
        </div>
    </div>

    <input name="repairid" value="${repairRecord.repairid}" type="hidden"/>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="CheckAdd" id="confirmBtn" >确定</button>
            <button class="layui-btn" lay-submit lay-filter="applyAdd" id="closeBtn" >关闭</button>
        </div>
    </div>

</form>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/layui/layui/layui.js"></script>
<script>
    layui.use(['form','layer','laydate','table','laytpl','upload'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;

        //关闭按钮的实现
        $("#closeBtn").click(function () {
            window.parent.location.reload();
        })

        //提交表单
        form.on("submit(CheckAdd)",function(data) {
            // var formData = new FormData($("#applyForm")[0]);
            $.ajax({
                url:"/repairRecord/doRepairRecordEdit",
                type: "post",
                data:$("#applyForm").serialize(),
                success:function (res) {
                    if(res.code == 1001){
                        layui.layer.msg("修改成功");
                    }else{
                        layui.layer.msg("修改失败");
                    }
                }
            });
            //点击提交后关闭悬浮窗
            setTimeout(function () {
                window.parent.location.reload();
            },1500);
            return false;
        });

        //绑定时间插件到文本框中
        $(".usetime").each(function () {
            laydate.render({
                elem:this,
                theme: 'grid',
                type: 'datetime'
            });
        });


    });
</script>
</body>
</html>